
#Python 学习

#九九乘法表

# for i in range(1 ,10) :
#     for j in range(1 , i + 1) :
#         print(f"{i:>1} * {j:>1} = {i*j:>1}\t" , end = " ")  # 此处的 end = '' 作用是横着打印
#     print()


# import tkinter as tk
#
# def calculate():
#     n = int(entry_n.get())
#     m = int(entry_m.get())
#     result = []
#     for x in range(n+1):
#         for y in range(n+1-x):
#             z = n - x - y
#             if z >= 0 and x*5 + y*3 + z/3 == m:
#                 result.append((x, y, z))
#     if result:
#         text_result.config(state=tk.NORMAL)
#         text_result.delete("1.0", tk.END)
#         for x, y, z in result:
#             text_result.insert(tk.END, f"公鸡{x}只，母鸡{y}只，小鸡{z}只\n")
#         text_result.config(state=tk.DISABLED)
#     else:
#         text_result.config(state=tk.NORMAL)
#         text_result.delete("1.0", tk.END)
#         text_result.insert(tk.END, "无解")
#         text_result.config(state=tk.DISABLED)
#
# def enumerate_process():
#     n = int(entry_n.get())
#     m = int(entry_m.get())
#     text_result.config(state=tk.NORMAL)
#     text_result.delete("1.0", tk.END)
#     for x in range(n+1):
#         for y in range(n+1-x):
#             z = n - x - y
#             text_result.insert(tk.END, f"公鸡{x}只，母鸡{y}只，小鸡{z}只\n")
#             text_result.update()
#             if z >= 0 and x*5 + y*3 + z/3 == m:
#                 text_result.insert(tk.END, "符合条件\n")
#             else:
#                 text_result.insert(tk.END, "不符合条件\n")
#             text_result.update()
#     text_result.config(state=tk.DISABLED)
#
# # 创建主窗口
# root = tk.Tk()
# root.title("百钱百鸡演示程序")
#
# # 创建输入框和标签
# label_n = tk.Label(root, text="总钱数：")
# label_n.grid(row=0, column=0, padx=5, pady=5)
# entry_n = tk.Entry(root)
# entry_n.grid(row=0, column=1, padx=5, pady=5)
# label_m = tk.Label(root, text="总鸡数：")
# label_m.grid(row=1, column=0, padx=5, pady=5)
# entry_m = tk.Entry(root)
# entry_m.grid(row=1, column=1, padx=5, pady=5)
#
# # 创建计算按钮和枚举按钮
# button_calculate = tk.Button(root, text="计算", command=calculate)
# button_calculate.grid(row=2, column=0, padx=5, pady=5)
# button_enumerate = tk.Button(root, text="枚举", command=enumerate_process)
# button_enumerate.grid(row=2, column=1, padx=5, pady=5)
#
# # 创建结果文本框
# text_result = tk.Text(root, width=50, height=10, state=tk.DISABLED)
# text_result.grid(row=3, column=0, columnspan=2, padx=5, pady=5)
#
# # 运行主循环
# root.mainloop()

